package com.boot2.core.dict;

/**
 * 
 * @ClassName: CommonEnum
 * @description: 系统内置若干枚举
 * @author zhangweilin
 * @date 2017年12月28日 下午7:23:49
 *
 */
public class CommonEnum {

	/**
	 * 
	 * @ClassName: SEX
	 * @description: 性别
	 * @author zhangweilin
	 * @date 2017年12月28日 下午7:25:37
	 *
	 */
	public static enum sex {
		male(1, "男"), female(2, "女"), unknow(0, "未知");

		private int index;
		private String name;

		private sex(int index, String name) {
			this.index = index;
			this.name = name;
		}

		public static String getName(int index) {
			for (sex c : sex.values()) {
				if (c.getIndex() == index) {
					return c.name;
				}
			}
			return null;
		}

		public String getName() {
			return name;
		}

		public void setName(String name) {
			this.name = name;
		}

		public int getIndex() {
			return index;
		}

		public void setIndex(int index) {
			this.index = index;
		}
	}

	/**
	 *
	 * @ClassName: FileType
	 * @description: 文件上传类型
	 * @author zhangweilin
	 * @date 2017年12月28日 下午7:25:37
	 *
	 */
	public static enum FileType {
		Image(1, "图片"), File(2, "普通文件");

		private int index;
		private String name;

		private FileType(int index, String name) {
			this.index = index;
			this.name = name;
		}

		public static String getName(int index) {
			for (sex c : sex.values()) {
				if (c.getIndex() == index) {
					return c.name;
				}
			}
			return null;
		}

		public String getName() {
			return name;
		}

		public void setName(String name) {
			this.name = name;
		}

		public int getIndex() {
			return index;
		}

		public void setIndex(int index) {
			this.index = index;
		}
	}

	/**
	 * 
	 * @ClassName: booleanValue
	 * @description: 布尔值
	 * @author zhangweilin
	 * @date 2017年12月28日 下午7:26:54
	 *
	 */
	public static enum BooleanValue {
		trueValue(1, "是"), falseValue(0, "否"), unknow(-1, "未知");

		private int index;
		private String name;

		private BooleanValue(int index, String name) {
			this.index = index;
			this.name = name;
		}

		public static boolean getBoolean(int index) {
			return index==1?true:false;
		}

		public static String getName(int index) {
			for (BooleanValue c : BooleanValue.values()) {
				if (c.getIndex() == index) {
					return c.name;
				}
			}
			return null;
		}

		public String getName() {
			return name;
		}

		public void setName(String name) {
			this.name = name;
		}

		public int getIndex() {
			return index;
		}

		public void setIndex(int index) {
			this.index = index;
		}
	}


 	/**
 	* @author zhangweilin
 	* @date 2020/5/31 9:39
 	* @Description:  系统日志
 	*/
	public static enum SysLogEnum {
		/**
		 *
		 */
		clearAllInvalidCache(1, "清除所有的无效缓存"), restartApp(2, "重启当前应用");

		private int index;
		private String name;

		private SysLogEnum(int index, String name) {
			this.index = index;
			this.name = name;
		}

		public static String getName(int index) {
			for (BooleanValue c : BooleanValue.values()) {
				if (c.getIndex() == index) {
					return c.name;
				}
			}
			return null;
		}

		public String getName() {
			return name;
		}

		public void setName(String name) {
			this.name = name;
		}

		public int getIndex() {
			return index;
		}

		public void setIndex(int index) {
			this.index = index;
		}
	}


	
	

}
